<template>
  <div>
    <!--多选Tab-->
    <el-table
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"
        stripe
    >

      <el-table-column
          prop="courseCode"
          label="课程编码"
          width="120">
      </el-table-column>

      <el-table-column
          prop="courseName"
          label="课程名称"
          width="120">
      </el-table-column>

      <el-table-column
          prop="title"
          label="问卷标题"
          width="120">
      </el-table-column>

      <el-table-column
          prop="startDate"
          label="预发布日期"
          show-overflow-tooltip>
      </el-table-column>

<!--      <el-table-column
          label="操作"
          width="180">
        <template slot-scope="scope">
          <el-button type="text" @click="goPaper(scope.row)" v-if="scope.row.status != 0">填写问卷</el-button>
          <el-divider direction="vertical" v-if="scope.row.status != 0"></el-divider>
        </template>
      </el-table-column>-->
    </el-table>

    <!--分页-->
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        layout="total, sizes, prev, pager, next, jumper"
        :page-sizes="[10, 20, 50, 100]"
        :current-page="current"
        :page-size="size"
        :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "Paper2",
  data() {
    return {
      delBtlStatu: true,
      dialogFormVisible: false,
      total: 0,
      size: 10,
      current: 1,
      tableData: [],
      multipleSelection: []
    }
  },
  created() {
    this.getPaperList()
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.size = val
      this.getPaperList()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.current = val
      this.getPaperList()
    },
    resetForm(formName) {
      // this.$refs[formName].resetFields();
      // this.editForm = {}
      this.editForm.questionList = [{
        paperId: '',
        targetId: '',
        content: '',
      }]
      this.dialogFormVisible = false
      // this.getPaperList()
    },
    handleClose() {
      this.resetForm('editForm')
    },
    getPaperList() {
      this.$axios.get("/paper/student/history", {
        params: {
          current: this.current,
          size: this.size
        }
      }).then(res => {
        this.tableData = res.data.data.records
        console.log(res.data.data.records)
        this.size = res.data.data.size
        this.current = res.data.data.current
        this.total = res.data.data.total
      })
    },
    goPaper(data) {
      this.$router.push("/answer/" + data.id)
    }
  }
}
</script>

<style scoped>

.el-select .el-input {
  width: 130px;
}

.input-with-select .el-input-group__prepend {
  background-color: #fff;
}

.el-pagination {
  float: right;
  margin-top: 10px;
}

.demo-table-expand {
  font-size: 0;
}

.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>